<template>
  <a-modal 
    :visible="visible" 
    :title="chatConfig.type === 'group' ? '新建群聊' : '新建聊天'"
    @ok="$emit('save-config')"
    @cancel="$emit('update:visible', false)"
    :width="600"
  >
    <a-form :model="chatConfig">
      <a-form-item label="会话类型">
        <a-radio-group v-model="chatConfig.type">
          <a-radio value="private">私聊</a-radio>
          <a-radio value="group">群聊</a-radio>
        </a-radio-group>
      </a-form-item>
      
      <a-form-item label="会话名称">
        <a-input v-model="chatConfig.sessionName" />
      </a-form-item>
      
      <div v-if="chatConfig.type === 'group'">
        <a-divider>群成员设置</a-divider>
        <div 
          v-for="(member, index) in chatConfig.members" 
          :key="index"
          class="member-item">
          <a-space direction="vertical">
            <a-input 
              v-model="member.name"
              placeholder="成员姓名"
              allow-clear />
            <a-textarea
              v-model="member.message"
              placeholder="预设消息内容"
              :auto-size="{ minRows: 1, maxRows: 3 }" />
          </a-space>
        </div>
        <a-button 
          type="dashed" 
          long
          @click="chatConfig.members.push({ name: '', message: '' })">
          <IconPlus /> 添加成员
        </a-button>
      </div>
    </a-form>
  </a-modal>
</template>

<script setup>
defineProps({
  visible: Boolean,
  chatConfig: Object
})
</script>

<style scoped>
/* 可按需添加样式 */
</style>